const express = require('express')
const router = express.Router()

router.get('/getlogin', (req, res) => {
  const {username, password} = req.query;
  if (username == "admin" && password == "123123") {
    res.send({code: 200, msg: "登录成功"});
  } else if (username != "admin") {
    res.send({code: 201, msg: "账号错误"});
  } else {
    res.send({code: 202, msg: "密码错误"});
  }
})

router.post('/postlogin', (req, res) => {
  const {username, password} = req.body;
  if (username == "admin" && password == "123123") {
    res.send({code: 200, msg: "登录成功"});
  } else if (username != "admin") {
    res.send({code: 201, msg: "账号错误"});
  } else {
    res.send({code: 202, msg: "密码错误"});
  }
})

module.exports = router